<template>
  <div class="app-container">
    <el-card>
      <template #header>
        <div class="card-header">
          <span>报表管理</span>
        </div>
      </template>
      <div class="report-management">
        <el-table :data="reportList" style="width: 100%">
          <el-table-column prop="name" label="报表名称" />
          <el-table-column prop="type" label="报表类型" />
          <el-table-column prop="createTime" label="创建时间" />
          <el-table-column prop="status" label="状态">
            <template #default="scope">
              <el-tag
                :type="scope.row.status === '已完成' ? 'success' : 'warning'"
              >
                {{ scope.row.status }}
              </el-tag>
            </template>
          </el-table-column>
          <el-table-column label="操作">
            <template #default="scope">
              <el-button size="small" @click="handleView(scope.row)"
                >查看</el-button
              >
              <el-button size="small" @click="handleDownload(scope.row)"
                >下载</el-button
              >
            </template>
          </el-table-column>
        </el-table>
      </div>
    </el-card>
  </div>
</template>

<script setup>
import { ref } from "vue";

const reportList = ref([
  {
    name: "月度能耗报表",
    type: "能耗报表",
    createTime: "2024-01-20 10:00",
    status: "已完成",
  },
  {
    name: "设备运行报表",
    type: "设备报表",
    createTime: "2024-01-20 09:30",
    status: "已完成",
  },
  {
    name: "报警统计报表",
    type: "报警报表",
    createTime: "2024-01-20 09:00",
    status: "生成中",
  },
]);

const handleView = (row) => {
  console.log("查看报表", row);
};

const handleDownload = (row) => {
  console.log("下载报表", row);
};
</script>

<style lang="scss" scoped>
.report-management {
  padding: 20px;
}
</style>
